<template>
	<view class="user-container">
		<view class="flex-sub text-center bg-white margin-top">
			<view class="solid-bottom text-xl padding">
				<text class="text-black text-bold">王大锤</text>
			</view>
			<view class="footer">时间: 2022-10-12</view>
		</view>
		<view class="flex-sub text-center bg-white margin-top">
			<view class="solid-bottom text-xl padding">
				<text class="text-black text-bold">王大锤</text>
			</view>
			<view class="footer">时间: 2022-10-12</view>
		</view>
	</view>
</template>

<script>
	/** detail.js **/

	import context from '../../lib/java110/Java110Context.js'
	const constant = context.constant; //获取app实例
	import conf from '../../conf/config.js'
	import {
		replaceImgSrc
	} from '../../lib/java110/utils/ImageUtil.js'
	//获取app实例
	const app = getApp().globalData;

	// import jyfParser from "@/components/jyf-parser/jyf-parser";

	export default {
		data() {
			return {
				notice: {
					title: "王大锤"
				},
				noticeId: '',
				communityId: ''
			};
		},

		components: {
			jyfParser
		},

		onLoad: function(options) {
			context.onLoad(options);
			let _noticeId = options.noticeId;
			this.noticeId = _noticeId;
			this.communityId = options.communityId;
			this._loadNoticeDetail();
		},
		onShow: function() {
			let that = this; // that.setData({
			//     userInfo: app.globalData.userInfo
			// });
		},
		methods: {
			_loadNoticeDetail: function() {
				let that = this;

				uni.request({
					// header: context.getHeaders(),
					url: "http://localhost:8888/data",
					method: "GET",
					data: {
						communityId: that.communityId,
						page: 1,
						row: 10,
						noticeId: that.noticeId
					},
					success: function(res) {
						// TODO 判断
						let notice = res.data.notices[1]
						notice.timeStr = notice.startTime.replace(/:\d{1,2}$/, ' ');
						notice.context = replaceImgSrc(notice.context, conf.baseUrl);
						that.notice = notice;
					}
				});
			}
		}
	};
</script>
<style>
	@import "@/pages/notice/detail/detail.css";
</style>
